package com.changli03._throws;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class throwsTest {
    public static void main(String[] args) {
        method3();
    }
    public static void method3 (){
        try{
            method();
        }
        catch(FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }

    }
    public static void method () throws FileNotFoundException, IOException {
        method1();
    }
    public static void method1()  throws FileNotFoundException, IOException {
        File file = new File("D:\\后端\\hello.txt");
        FileInputStream fis = new FileInputStream(file); //可能报错 FileNotFoundException
        int data = fis.read(); //可能报 IOEception
        while (data != -1){
            System.out.print((char)data);
            data = fis.read();//可能报 IOEception
        }

        fis.close();//可能报 IOEception
    }
}
